ArcPad Scripting Object Model
Get Selected Feature
Send Feedback
ArcPad Scripting Object Model Reference > ArcPad Scripting Samples > Get Selected Feature

Glossary Item Box

Description:

This sample gets a reference to the selected feature's recordset and displays the value of the first attribute in a message box.

How to use:

  1. Select a feature in the map.
  2. Paste the JScript or VBScript code into the Script dialog box (depending on which language is set as the default scripting language).
  3. Click/Tap the Execute icon.

 

JScript

Copy Code
function GetSelected()
{
  var pRS;
  if (Map.SelectionLayer == null)
return;
  pRS = Map.SelectionLayer.Records;
  pRS.Bookmark = Map.SelectionBookmark;
  Application.MessageBox (pRS.Fields(1).Value.toString());
  pRS = null;
}
GetSelected();
 

VBScript

Copy Code
Sub GetSelected()
  Dim pRS
  If (Map.SelectionLayer Is Nothing) Then Exit Sub
  Set pRS = Map.SelectionLayer.Records
  pRS.Bookmark = Map.SelectionBookmark
  Application.MessageBox CStr(pRS.Fields(1).Value)
  Set pRS = Nothing
End Sub
Call GetSelected()
 
©2012. All Rights Reserved.